package com.crm.base.domain;

/**
 * @Author：Albert
 * @Version：1.0
 * @Date：2024/7/3-15:06
 * @Since：jdk1.8
 * @Description：
 */
public class AjaxResult {
    private Boolean success = true;
    private String msg;
    private Object data;

    public Integer code =20000;

    /**
     * true
     * @return
     */
    public static AjaxResult me(){
        return new AjaxResult(true,"操作成功", null);
    }

    /**
     * false
     * @param msg
     * @return
     */
    public static AjaxResult me(String msg){
        return new AjaxResult(false,msg, null);
    }

    /**
     * true
     * @param data
     * @return
     */
    public static AjaxResult me(Object data){
        return new AjaxResult(true,"操作成功", data);
    }

    private AjaxResult(Boolean success, String msg, Object data) {
        this.success = success;
        this.msg = msg;
        this.data = data;
    }

    public Boolean getSuccess() {
        return success;
    }

    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public AjaxResult setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public Object getData() {
        return data;
    }

    public AjaxResult setData(Object data) {
        this.data = data;
        return this;
    }
}
